﻿/**
 * ...
 * @author waneck
 */

package asc.events;

enum NetConnectionStatus 
{

	NetConnectionCallFailed(desc:String);
	NetConnectionConnectAppShutdown(desc:String);
	NetConnectionConnectClosed(desc:String);
	NetConnectionConnectFailed(desc:String);
	NetConnectionConnectRejected(desc:String);
	NetConnectionConnectSuccess(desc:String);
	NetConnectionProxyNotResponding(desc:String);
	
}

class NetConnectionTranslator
{
	public static function translate(infoObj: { code:String, level:String, description:String } ):NetConnectionStatus
	{
		return switch (infoObj.code)
		{
			case "NetConnection.Call.Failed":
				NetConnectionCallFailed(infoObj.description);
			case "NetConnection.Connect.AppShutdown":
				NetConnectionConnectAppShutdown(infoObj.description);
			case "NetConnection.Connect.Closed":
				NetConnectionConnectClosed(infoObj.description);
			case "NetConnection.Connect.Failed":
				NetConnectionConnectFailed(infoObj.description);
			case "NetConnection.Connect.Rejected":
				NetConnectionConnectRejected(infoObj.description);
			case "NetConnection.Connect.Success":
				NetConnectionConnectSuccess(infoObj.description);
			case "NetConnection.Proxy.NotResponding":
				NetConnectionProxyNotResponding(infoObj.description);
		}
	}
}